<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
</head>

<body>
    <input type="text" id="text_a" />
    <select name="chose" id="s_chose">
			<option value="a">+</option>
			<option value="b">-</option>
			<option value="c">x</option>
			<option value="d">/</option>
		</select>
    <input type="text" id="text_b" /> 结果：
    <input type="text" id="text_res" />
    <button id="b_calc">计算</button>
</body>
<script type="text/javascript">
    document.getElementById("b_calc").onclick = function() {
        var chose = document.getElementById("s_chose").value
        var text_a = parseFloat(document.getElementById("text_a").value)
        var text_b = parseFloat(document.getElementById("text_b").value)
        if (chose == "a") {
            document.getElementById("text_res").value = (text_a + text_b).toFixed(4);
        } else if (chose == "b") {
            document.getElementById("text_res").value = (text_a - text_b).toFixed(4);
        } else if (chose == "c") {
            document.getElementById("text_res").value = (text_a * text_b).toFixed(4);
        } else if (chose == "d") {
            document.getElementById("text_res").value = (text_a / text_b).toFixed(4);
        }
    }
</script>

</html>